package com.lzx.article.controller.web;

import com.lzx.article.entity.Comments;
import com.lzx.article.service.CommentsService;
import com.lzx.article.vo.NicknameVO;
import com.lzx.article.vo.OssVO;
import com.lzx.common.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/article/comments/web")
public class WebCommentsController {
    @Resource
    private CommentsService commentsService;

    //修改用户昵称(文章一级评论)
    @PutMapping("/updateNicknameToComments")
    public String updateNicknameToComments(@RequestBody NicknameVO nicknameVO) {
        return commentsService.updateNicknameToComments(nicknameVO);
    }

    //修改用户头像(文章一级评论)
    @PutMapping("/updateAvatarToComments")
    public String updateAvatarToComments(@RequestBody OssVO ossVO) {
        return commentsService.updateAvatarToComments(ossVO);
    }

    //用户发表评论
    @PostMapping("/publishComments")
    public R publishComments(@RequestBody Comments comments) {
        return commentsService.publishComments(comments);
    }
}
